/*
 * @Description:
 * @Version: 1.0
 * @Autor: lzc
 * @Date: 2021-07-14 17:08:03
 * @LastEditors: lzc
 * @LastEditTime: 2021-11-23 15:04:33
 */

#ifndef _STORE_H
#define _STORE_H

#include <rtthread.h>
#include <rtdevice.h>
#include "drv_gpio.h"
#include "startup.h"
#include "my_elcdif.h"
#include "at24cxx.h"
#include <stdio.h>
#include "GUI.h"
#include "WM.h"

#define IIC_DEVICE_NAME         "i2c1"  /* IIC设备名称 */
#define DEFAULT_FF              0xff
#define RECORD_FAT_SIZE         (5) // 要存储几组
#define RECORD_FAT_ADDR_START   (0) // 目录的起始存储地址 
#define RECORD_SAVE_ADDR_START  (10)// 历史记录的存储地址
#define HISTORY_DEBUGB          (0) // 是否进入调试模式

typedef struct
{
    // 测试数据1
    float Current_Test1;
    // 测试数据2
    double Current_Test2;
    // 测试数据3
    int Current_Test3;
    // 测试数据4
    char Current_Test4;
    // 测试数据5
    bool Current_Test5;
    // 测试数据6
    long Current_Test6;

} Store_Test_Status_t;

typedef struct Link
{
    int  elem;
    int  Num_list;
    struct Link *next;
} link; 


int delElem(link *p, int del_Data_Num);
int insertElem(link *p);


void EEPROM_History_Init_FAT(void);                                                             //初始化
void EEPROM_History_Add_One_Record(void *Record_Write_Ptr, int Size);                           //增
void EEPROM_History_Delate_One_Record(uint16_t Record_Num, void *Record_Delate_Ptr, int Size);  //删
void EEPROM_History_Select_One_Record(uint16_t Record_Num, void *Record_Read_Ptr, int Size);    //查
void EEPROM_History_Delate_All_Record(void);                                                    //全删


void EEPROM_Write_StructData(uint32_t Write_Addr, void *data, uint32_t Write_Struct_Size);      //写入
void EEPROM_Read_StructData(uint32_t Read_Addr, void *data, uint32_t Read_Struct_Size);         //读取
#endif
